package edu.stu.mall.fragment.personal

import android.app.Application
import android.util.Log
import androidx.lifecycle.viewModelScope
import edu.mall.base.BaseViewModel
import edu.mall.base.SingleLiveEvent
import edu.stu.mall.repository.Repository
import edu.stu.mall.repository.data.ProductCategoryListData
import edu.stu.mall.repository.data.UserInfo
import kotlinx.coroutines.launch

class FragPersonalViewModel(application: Application) : BaseViewModel(application) {
    var userInfo = SingleLiveEvent<UserInfo?>()
    init {
        getUserInfo()
    }

    private fun getUserInfo() {
        viewModelScope.launch {
            val data = Repository.getUserInfo()
            if (data != null) {

                userInfo.postValue(data)
            }
        }
    }
}